﻿@{
    Layout = null;
}

@using CNKI.TPI.Web.Search.Model;
<script>
    function templateSave(str) {
        if (str == "save") {
            disablesave();
        }
        $.ajax({
            type: "POST",
            url: "@Html.Raw(Url.Action("TemplateSave", "Admin_SingleDBPublish"))",
            data: {
                "DbID": $("#DbID").val(),
                "templateID": $("#publishType").val(),
                "visibleFlage": $('input:radio[name="Isvisible"]:checked').val(),
                "DBSort": $("#sortDefault").val()
            },
            success: function (msg) {
                if (msg == "True") {
                    if (str == "next") //下一步
                    {
                        var urlstr = "@Html.Raw(Url.Action("SearchColumn", "Admin_SingleDBPublish"))";
                        var dataobj = { "DbID": $("#DbID").val() };
                        ajaxLoad("initload", urlstr, dataobj);
                    }
                    else {
                        messageAlert("操作成功！");
                        enablesave();
                    }
                }
                else {
                    messageAlert("操作失败！");
                }

            },
            error: function (e)
            { }
        })
    }
    function disablesave() {
        $(".btn-warn-f").attr("disabled", "disabled");
    }
    function enablesave() {
        $(".btn-warn-f").removeAttr("disabled", "disabled");
    }
</script>
<!-- wrapRStart -->
<div class="wrapR-h">
    @if (ViewBag.PubFlage == 1)
    {
        <h3 style="color:red">修改模式下可以点选下列菜单进行字段设置</h3>
    }
    <ul class="step step-line-4 clearfix">
        @if (ViewBag.PubFlage == 1)//修改时允许点击
        {
            <li class="next cur"><a onclick="jumpPage('@Html.Raw(Url.Action("Config", "Admin_SingleDBPublish"))')">发布形式设置</a>  </li>
            <li class="next"><a onclick="jumpPage('@Html.Raw(Url.Action("SearchColumn", "Admin_SingleDBPublish"))')">检索字段</a></li>
            <li class="next"><a onclick="jumpPage('@Html.Raw(Url.Action("ViewColumn", "Admin_SingleDBPublish"))')">概览字段</a></li>
            <li class="next"><a onclick="jumpPage('@Html.Raw(Url.Action("DetialColumn", "Admin_SingleDBPublish"))')">细览字段</a></li>
            <li class="done"><a onclick="jumpPage('@Html.Raw(Url.Action("SortColumn", "Admin_SingleDBPublish"))')">排序字段</a></li>
        }
        else //发布
        {
            <li class="next cur">发布形式设置</li>
            <li class="next">检索字段</li>
            <li class="next">概览字段</li>
            <li class="next">细览字段</li>
            <li class="next">排序字段</li>
            <li class="done">完成</li>
        }


    </ul>
</div>

<div class="wrapR-c">
    <div class="wrapR-h-b">
        <span>数据库名称：@ViewBag.DbName</span><span>数据库代码：@ViewBag.DbCode</span>
        <span>发布形式：
        <select class='span2' name="publishType" id="publishType">
            @foreach (SYS_CMS_PUBLISHTYPE item in ViewBag.PublishType)
            {
                if (item.SysID == ViewBag.TemplateID)
                {
                <option value="@item.SysID" selected="selected">@item.Name</option>
                }
                else
                {
                <option value="@item.SysID">@item.Name</option>
                }
            }
        </select></span>
    </div>

    @*    <div class="wrapR-c-t">
        <img src="~/Content/admin/images/tp.gif" alt="" />
    </div>*@
    <div class="wrapR-c-b form form-h form-h-10em">
        @*   <div class="f-gp">
            <div class="f-lb">
                <label class="f-label">默认概览显示形式：</label>
            </div>
            <div class="f-ct">
                <label class="f-label">
                    <input type="radio" class="f-radio">
                    列表（网格）</label>
                <label class="f-label">
                    <input type="radio" class="f-radio">
                    摘要</label>
            </div>
        </div>*@

        <div class="f-gp">
            <div class="f-lb">
                <label class="f-label">是否对用户可见：</label>
            </div>
            <div class="f-ct">
                @{
                    string check0 = "";
                    string check1 = "";
                    if (ViewBag.VisibleFlage == 0)
                    {
                        check0 = "checked=checked";
                    }
                    else
                    {
                        check1 = "checked=checked";
                    }
                }
                <label class="f-label">
                    <input type="radio" name="Isvisible" class="f-radio" value="1" @check1>
                    可见</label>
                <label class="f-label">
                    <input type="radio" name="Isvisible" value="0" class="f-radio" @check0>
                    不可见</label>
            </div>
            <span class="f-label">检索结果默认排序：
            <select id="sortDefault">
                @if (ViewBag.Sort == 1)
                {
                    <option value="0">倒序</option>
                    <option value="1" selected="selected">正序</option>
                }
                else
                {
                    <option value="0" selected="selected">倒序</option>
                    <option value="1">正序</option>
                }

            </select>
            </span>
        </div>

    </div>

    <div class="tc">
        @if (ViewBag.PubFlage == 0)
        {
            <a class="btn btn-m btn-prim-f" href="javascript:void(0);" onclick="ajaxLoad('initload','@Html.Raw(Url.Action("Index", "Admin_SingleDBPublish"))');">返回</a>
            <a class="btn btn-m btn-submit btn-prim-f" href="javascript:void(0);" onclick="templateSave('next')">下一步</a>

        }
        else
        {
            <button class="btn btn-m btn-prim-f"  onclick="ajaxLoad('initload','@Html.Raw(Url.Action("Index", "Admin_SingleDBPublish"))');">返回</button>
            <button class="btn btn-m btn-submit btn-warn-f" style="margin-left:30px;" onclick="templateSave('save')">保存</button>

        }


    </div>
    <input type="hidden" id="DbID" name="DbID" value="@ViewBag.DbID" />
</div>
<!-- wrapREnd -->

